#class People:经典类
class People(object):#新式类

    def __init__(self,name,age):
        self.name = name
        self.age = age
        self.friends = []
    def eat(self):
        print('%s is eating' %self.name)

    def sleep(self):
        print('%s is sleeping' %self.name)
class Relation(object):
    def __int__(self):
        #pass
        print(self.name)
    def make_friends(self,obj):#obj=w1
        print('%s is making friends with %s' %(self.name,obj.name))
        self.friends.append(obj)
class Man(People,Relation):#执行了People的构造函数就不会再执行Relation的构造函数
    def __init__(self,name,age,money):
        #People.__init__(self,name,age)#加新功能
        super(Man,self).__init__(name,age)#新式类写法
        self.money = money
        print ('%s 一出生就有 %s money...'%(self.name,self.money))
    def piao(self):
        print('%s is piaoing....20s...done'%self.name)
    def sleep(self):
        People.sleep(self)#self = m1,,,加新功能
        print('man is sleeping')

class Woman(People,Relation):#从左到右的执行顺序
    def get_birth(self):
        print('%s is making a baby....'% self.name)
    def sleep(self):
        People.sleep(self)#self = m1
        print('woman is sleeping')

m1 = Man('ouyang',22,121)
# m1.eat()
# m1.sleep()
# m1.piao()
w1 = Woman("shangguan",32)
# w1.eat()
# w1.sleep()
# w1.get_birth()
w1.name = 'murong'
m1.make_friends(w1)
print(m1.friends)
print(m1.friends[0].name)